<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>js01</title>
    </head>
    <body>

            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
            <input type="checkbox" name="box" />
        
        <script>

            var arr = document.getElementsByName('box');
            for(var i = 0;i<arr.length;i++){
                arr[i].value = i+1;
                arr[i].checked = true;
            }
            
        </script>


    </body>
</html>